package achi.community.irla.entities;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

@Entity
public class Friends implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @JoinColumn(name = "USER_FK")
    @ManyToOne
    private Users uuser;

    @JoinColumn(name = "FRIEND_FK")
    @ManyToOne
    private Users friend;



    //@OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
    //@JoinColumn(name = "FRIEND_FK")
    //private Users friend;

    
    /**
     * only used to implement Serializable.
     */
    public Friends() {}

    public Friends(Users user, Users friend) {
        this.uuser = user;
        this.friend = friend;
    }

     /**
     * creates a new Friends entity
     * @param fname value of the firstName column
     * @param lname value of the lastName column
     * @param email value of the email column
     * @param address value of the address column
     */

    public Users getFriend() {
        return friend;
    }

    public void setFriend(Users friend) {
        this.friend = friend;
    }

    public void setUuser(Users uuser) {
        this.uuser = uuser;
    }

    public Users getUuser() {
        return uuser;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

/**
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Customer)) {
            return false;
        }
        Customer other = (Customer) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.chl.rignas.jpa.nbp.Customer[id=" + id + "]";
    }
 * */
}
